<?php defined('InShopNC') or exit('Access Invalid!');?>
<script src="<?php echo SHOP_RESOURCE_SITE_URL.'/js/search_goods.js';?>"></script>
<link href="<?php echo SHOP_TEMPLATES_URL;?>/css/new/new-index.css" rel="stylesheet" type="text/css">
<!--轮播模块-->
<?php
    echo $output['web_html']['new_indexp'];
    unset($output['web_html']['new_indexp']);
?>
<!--轮播下面的登录框-->
<script>
    var user_box =<?php echo '`'; ?>
    <div class="tx_img">
        <div class="img">
        <!--用户照片-->
            <img src="<?php echo getMemberAvatar($_SESSION['avatar']);?>" alt="">
        </div>
    </div>
        <!--用户姓名-->
            <br>
    <div class="user_test">
        Hi,
        <?php if($_SESSION['is_login'] == '1'){ ?>
            <a href="<?php echo urlShop('member','home'); ?>"><?php echo $_SESSION['member_name']; ?></a>
        <?php }else{ ?>
            请<a href="<?php echo urlLogin('login'); ?>">登录</a>
        <?php } ?>
    </div>
    <?php if($_SESSION['is_login'] != '1'){ ?>
    <!--按钮-->
    <div class="user_btn_box">
        <a href="<?php echo urlLogin('login'); ?>">
            <div class="btn">登录</div>
        </a>
        <a href="<?php echo urlLogin('login','register'); ?>">
            <div class="btn">注册</div>
        </a>
        <a href="<?php echo urlShop('show_joinin', 'enter_help'); ?>">
            <div class="btn">开店</div>
        </a>
    </div>
    <?php } ?>
    <?php echo '`;'; ?>

    $('#user_box').html(user_box);
</script>

<!--限时优惠-->
<?php if(!empty($output['xianshi_item'])||!empty($output['xianshi_item2'])){ ?>
<div class="timeLimit_box">
    <div class="timeLimit_cen">
        <div class="top">
            <!--主题-->
            <div class="theme">
                限时优惠
            </div>
            <!--选项-->
            <div class="list_box">
                <div class="list <?php if(!empty($output['xianshi_item'])){echo 'active';} ?>" >
                    正在进行
                </div>
                <div class="list <?php if(empty($output['xianshi_item'])&&!empty($output['xianshi_item2'])){echo 'active';} ?>">
                    即将开始
                    <span>
                            明天开始 09:00
                            </span>
                </div>
            </div>
        </div>
        <!--产品列表-->

        <div class="cp_box" style="display: <?php if(!empty($output['xianshi_item'])){echo 'block';}else{echo 'none';} ?>;">
            <?php if(!empty($output['xianshi_item'])){ ?>
            <ul>
                <?php foreach($output['xianshi_item'] as $v){ ?>
                <li class="list">
                    <div class="cp_img">
                        <img src="<?php echo $v['image_url'];?>" alt="<?php echo $v['goods_name']; ?>">
                    </div>
                    <div class="cp_test" title="<?php echo $v['goods_name']; ?>">
                        <?php echo $v['goods_name']; ?>
                    </div>
                    <div class="cp_test2">
                        <?php $goods_price = explode('.',$v['xianshi_price']);?>
                        ￥<span><?php echo $goods_price[0]; ?></span>.<?php echo $goods_price[1]; ?>
                        <span>￥<?php echo $v['goods_price']; ?></span>
                    </div>
                    <a href="<?php echo urlShop('goods','index',array('goods_id'=> $v['goods_id'])); ?>">
                        <div class="btn">
                            立即抢购
                        </div>
                    </a>
                </li>
                <?php } ?>
            </ul>
            <!--二维码展示-->
            <div class="ewmImg">
                <img src="<?php echo SHOP_TEMPLATES_URL;?>/images/newimages/ewm_img1png.png" alt="">
                <img class="applet_qrcode" src="<?php echo UPLOAD_SITE_URL.DS.ATTACH_MOBILE.DS.C('applet_qrcode');?>" alt="">
            </div>
            <?php }else{ ?>
                暂无数据
            <?php } ?>
        </div>


		    <div class="cp_box" style="display:<?php if(empty($output['xianshi_item'])&&!empty($output['xianshi_item2'])){echo 'block';}else{echo 'none';} ?>;">
                <?php if(!empty($output['xianshi_item2'])){ ?>
			    <ul>
				    <?php foreach($output['xianshi_item2'] as $v){ ?>
				    <li class="list">
					    <div class="cp_img">
						    <img src="<?php echo $v['image_url'];?>" alt="<?php echo $v['goods_name']; ?>">
					    </div>
					    <div class="cp_test" title="<?php echo $v['goods_name']; ?>">
						    <?php echo $v['goods_name']; ?>
					    </div>
					    <div class="cp_test2">
						    <?php $goods_price = explode('.',$v['xianshi_price']);?>
						    ￥<span><?php echo $goods_price[0]; ?></span>.<?php echo $goods_price[1]; ?>
						    <span>￥<?php echo $v['goods_price']; ?></span>
					    </div>
					    <a href="<?php echo urlShop('goods','index',array('goods_id'=> $v['goods_id'])); ?>">
						    <div class="btn">
							    立即抢购
						    </div>
					    </a>
				    </li>
				    <?php } ?>
			    </ul>
			    <!--二维码展示-->
			    <div class="ewmImg">
				    <img src="<?php echo SHOP_TEMPLATES_URL;?>/images/newimages/ewm_img1png.png" alt="">
                    <img class="applet_qrcode" src="<?php echo UPLOAD_SITE_URL.DS.ATTACH_MOBILE.DS.C('applet_qrcode');?>" alt="">
			    </div>
                <?php }else{ ?>
                    暂无数据
                <?php } ?>
		    </div>

    </div>
</div>
<?php } ?>
<!--促销（新品）模块-->
<?php
echo $output['web_html']['new_indexs'];
unset($output['web_html']['new_indexs']);
?>
<!--其他模块-->
<?php foreach($output['web_html'] as $v){ echo $v; }?>

<!--猜你喜欢-->
<div id="guesslike" class="recommend_box">
    <div class="recommend_cen">
        <div class="top">
            <!--主题-->
            <div class="theme">
                猜你喜欢
            </div>
        </div>
        <div class="cp_list">
            <ul id="container">
                <li style="display:none;" class="item"></li>
            </ul>
        </div>
    </div>
    <div align="center" id="page-nav" class="recommend_box"></div>
    <div id="navigation">
        <a href="index.php?act=index&op=new_viewed_list&curpage=1"></a>
    </div>
</div>
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/fly/jquery.fly.min.js" charset="utf-8"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/jquery.infinitescroll.js" type="text/javascript"></script>
<script>

    $(document).ready(function (){
        $("#container").infinitescroll({
            navSelector: "#navigation",
            nextSelector: "#navigation a",
            itemSelector: ".item " ,
            maxPage: 4,
            loading: {
                selector:'#page-nav',
                img: '<?php echo SHOP_TEMPLATES_URL;?>/images/loading.gif',
                msgText:'加载中...',
                finishedMsg : '没有记录了',
                finished : function() {
                    $("#page-nav").html('');
                    //重新绑定添加购物车事件
                    $('a[nctype="add_cart"]').click(function() {
                        flyToCart($(this));
                    });
                }
            },
            errorCallback: function() { //加载完数据后的回调函数
                if(2>$('#container li').size()){
                    $('#guesslike').hide();
                }
            },
        });
    });
</script>